home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / xconq / global.h < prev    next >
C/C++ Source or Header  |  1995-05-09  |  2KB  |  53 lines

  1. /* Copyright (c) 1987, 1988  Stanley T. Shebs, University of Utah. */
  2. /* This program may be used, copied, modified, and redistributed freely */
  3. /* for noncommercial purposes, so long as this notice remains intact. */
  4.  
  5. #pragma comment(exestr, "@(#) global.h 12.1 95/05/09 ")
  6.  
  7. /* RCS $Header: global.h,v 1.1 88/06/21 12:29:41 shebs Exp $ */
  8.  
  9. /* Global data structures. */
  10.  
  11. /* There is actually no inherent limit on the number of winning and losing */
  12. /* conditions, but scenarios usually only need a couple. */
  13.  
  14. #define NUMCONDS 10
  15.  
  16. /* Not many types of conditions (probably could think of a few more). */
  17.  
  18. #define TERRITORY 0
  19. #define UNITCOUNT 1
  20. #define RESOURCECOUNT 2
  21. #define POSSESSION 3
  22.  
  23. /* Win/lose conditions can take several different forms.  Some of these */
  24. /* slots could be glommed into a union, but so what... */
  25.  
  26. typedef struct a_condition {
  27.     bool win;                   /* is this a condition of winning or losing? */
  28.     int type;                   /* based on units, resources, or location? */
  29.     int starttime;              /* first turn to check on condition */
  30.     int endtime;                /* last turn to check on condition */
  31.     int sidesn;                 /* side number to which this cond applies */
  32.     int units[MAXUTYPES];       /* numbers for each type of unit */
  33.     int resources[MAXRTYPES];   /* numbers for each type of resource */
  34.     int x, y;                   /* a location */
  35.     int n;                      /* a vanilla value */
  36. } Condition;
  37.  
  38. /* Definition of structure containing all global variables. */
  39.  
  40. typedef struct a_global {
  41.     int time;            /* the current turn */
  42.     int endtime;                /* the last turn of the game */
  43.     bool setproduct;            /* true if production changes allowed */
  44.     bool leavemap;              /* true if units can leave the map */
  45.     int numconds;               /* number of conditions... */
  46.     Condition winlose[NUMCONDS];  /* and space for the conditions themselves */
  47. } Global;
  48.  
  49. /* Just have the one "global" object. */
  50.  
  51. extern Global global;
  52.  
  53.